/**
 * npm login: bless0215
 * password: ^`123`123$
 */

const cfg1 = {
  configureWebpack: () => {
    return {
      entry: './src/widgets/index.js',
      output: {
        filename: 'publish/lib/index.js',
        library: 'dfish',
        libraryTarget: 'umd',
        umdNamedDefine: true
      }
    }
  },
  chainWebpack: config => {
    config
      // 插件名 
      .plugin('extract-css')
      // 修改规则
      .tap(args => {
        args[0].filename = 'publish/css/style.css'
        args[0].chunkFilename = 'css/[name].css'
        return args
      })
  }
} 

const cfg2 = {
  configureWebpack: {
    output: {
      libraryExport: 'default'
    }
  }
}

//rollup时开启 cfg1, 打包umd时开启cfg2
module.exports = cfg1